import React from 'react';
import { ts2Formatter, renderState, renderEnable } from 'utils';
import moment from 'moment';
import { actions } from 'mirrorx';
{/*
可配置化种类：

1、表格头部字段 
    1、列表页表格头部字段集合 mainTableColumn
    2、编辑页表格头部字段集合 childTableColumn

2、编辑框的字段
    1、编辑页 直接显示在页面的编辑字段 FormField
    2、编辑页 需要点击表格的增行弹框编辑的字段 FormTableField
    3. 列表页查询区域  searchField

3.表头部的按钮  headerButtonSets

4.表行尾部按钮  columnButtonSets
*/}

//表头信息

//字段属性

//基本信息
const FormDataHeader = [
    {
        enname: "billCode",
        zhname: "单据号",
        type: "FormControl",
        hidepage: { 0: true },
        edit: true,
        required: true,
    },
    {
        enname: "activityName",
        zhname: "标题",
        type: "FormControl",
        pattern:/^\S*$/,
        message: "不能有空格",
        edit: true,
        required:true
    },
    {
        enname: "planTypeId",
        codename: "planTypeCode",
        showname: "planTypeName",
        zhname: "流程类型",
        code: "PLAN_TYPE",
        required:true,
        showcontrol:[
            {
                value: "01",
                refKey: "refcode",
                dtoKey: "planTypeCode",
                layer: ["FormField", "DataHeader", "Field"],
                fields: ["saleStatisticBasisId"]
            },
            // {
            //     value: "01",
            //     refKey: "refcode",
            //     dtoKey: "planTypeCode",
            //     layer: ["childTableColumn", "activitySchemeExpenses"],
            //     fields: "all"
            // }
        ],
        type: "Select",
        edit: true,
    },
    {
        enname: "urgencyDegreeId",
        codename: "urgencyDegreeCode",
        showname: "urgencyDegreeName",
        zhname: "紧急程度",
        code: "URGENCY_DEGREE",
        type: "Select",
        edit: true,
        required: false,
    },
    {
        enname: "organizationId",
        showname: "organizationName",
        codename: "organizationCode",
        zhname: "隶属组织",
        type: "RefComponent",
        refname: "organization",
        cascadeName: [{
            paramkey: "EQ_organization.id",
            childtype: "DataHeader",
            refKey: "refpk",
            dtoKey: "organizationId",
            offers: "reportAreaId",
            resetOffersFlag: true,
        },{
            paramkey: "EQ_organization",
            childtype: "DataHeader",
            refKey: "refpk",
            dtoKey: "organizationId",
            offers: "approvalId",
            resetOffersFlag: true,
        }],
        cascadeChildTable:[{
            refKey: "refpk", 
            dtoKey: "organizationId",
            childType:"activityDetails" 
        }],
        param:{
            "AUTH_refdim": "organization", 
            "AUTH_refcod": "ActivityScheme"
        },
        edit: true,
        required: true,
    },
    {
        enname: "approvalId",
        codename: "approvalCode",
        showname: "approvalName",
        zhname: "审批管理",
        refname: "approvalDocJCSP001",
        alias:"organizationId",
        type: "RefComponent",
        edit: true,
        required: true,
    },
    {
        enname: "brandId",
        codename: "brandCode",
        showname: "brandName",
        zhname: "商品品牌",
        param:{
            "AUTH_refdim": "commoditybrand", 
            "AUTH_refcod": "ActivityScheme"
        },
        refname: "brandref",
        type: "RefComponent",
        edit: true,
        required:true,
    },
    {
        enname: "goodsCategoryId",
        codename: "goodsCategoryCode",
        showname: "goodsCategoryName",
        zhname: "商品品类",
        refname: "terminalGoodsCate",
        type: "RefComponent",
        edit: true,
        required:true,
    },
    {
        enname: "activityFeeTypeId",
        codename: "activityFeeTypeCode",
        showname: "activityFeeTypeName",
        zhname: "决裁名称",
        type: "RefComponent",
        refname: "defdoc",
        relation: [
            {
                ref: "adjudicationTypeId",
                refpk: "parentId",
                refcode: "parentCode",
                refname: "parentName",
                relationType: "ref",
        }],
        cascadeName: {
            paramkey: "EQ_judgement",
            childtype: "DataHeader",
            refKey: "refpk",
            dtoKey: "activityFeeTypeId",
            offers: "expenseBusiTypeId",
            resetOffersFlag: true,
        },
        cascadeChildTable:[{
            refKey: "planSaleNum", //清空数量  不同的决裁名称 会显示planSalNum 并且有计算
            dtoKey: "planSaleNum",
            childType:"activityDetails"
        },{
            refKey: "planCostAmount", //清空数量  不同的决裁名称 会显示planSalNum 并且有计算
            dtoKey: "planCostAmount",
            childType:"activityDetails"
        }],
        showcontrol:[
            {
                value: "1001A810000000006SO6,1001A810000000006SO7,1001A810000000006SOA,1001A810000000006SOB",
                refKey: "refpk",
                dtoKey: "activityFeeTypeId",
                hideFlag:true,
                layer: ["FormField", "DataHeader", "Field"],
                fields: ["expenseBusiTypeId","costCalculationTypeId", "urgencyDegreeId"]
            },
            {
                value: "1001A810000000006SO6,1001A810000000006SO7,1001A810000000006SOA,1001A810000000006SOB",
                refKey: "refpk",
                dtoKey: "activityFeeTypeId",
                hideFlag:true,
                layer: ["childTableColumn", "activityDetails", "column"],
                fields: ["customerName","saleTypeCode", "singleCost", "occurMonth"]
            },
            {
                value: "1001A810000000006SO6,1001A810000000006SO7,1001A810000000006SOA,1001A810000000006SOB",
                refKey: "refpk",
                dtoKey: "activityFeeTypeId",
                layer: ["childTableColumn", "activityDetails", "column"],
                fields: ["remark"]
            },
            
            {
                value: "1001A810000000006SO7,1001A810000000006SOA,1001A810000000006SOB",
                refKey: "refpk",
                dtoKey: "activityFeeTypeId",
                hideFlag:true,
                layer: ["childTableColumn", "activityDetails", "column"],
                fields: ["planSaleAmount"]
            },
            {
                value: "1001A810000000006SO7",
                refKey: "refpk",
                dtoKey: "activityFeeTypeId",
                hideFlag:true,
                layer: ["childTableColumn", "activityDetails", "column"],
                fields: ["planSaleNum"]
            },
            {
                value: "1001A810000000006SO7,1001A810000000006SOA,1001A810000000006SOB",
                refKey: "refpk",
                dtoKey: "activityFeeTypeId",
                hideFlag:true,
                layer: ["childTableColumn", "activityDetails", "column"],
                fields: ["costRate"]
            },
            {
                value: "1001A810000000006SOA,1001A810000000006SOB,1001A11000000001IAFR,1001A11000000001RITR,1001A11000000001RITP",
                refKey: "refpk",
                dtoKey: "activityFeeTypeId",
                layer: ["childTableColumn", "activityDetails", "column"],
                fields: [ "shopName"]
            },{ 
                value: "1001A810000000006SO5,1001A81000000000ANK0", 
                refKey: "refpk",
                dtoKey: "activityFeeTypeId",
                layer: ["childTableColumn", "activityDetails", "column"],
                fields: [ "planCostAmount2"]
            },{ 
                value: "1001A810000000006SO6", 
                refKey: "refpk",
                dtoKey: "activityFeeTypeId",
                layer: ["childTableColumn", "activityDetails", "column"],
                fields: [ "giftAmount"]
            },{ 
                value: "1001A810000000006SO7,1001A810000000006SOA,1001A810000000006SOB", 
                refKey: "refpk",
                dtoKey: "activityFeeTypeId",
                layer: ["childTableColumn", "activityDetails", "column"],
                fields: ["expenseBusiTypeName", "companyResponsibilityAmount"]
            },{ 
                value: "1001A810000000006SO7", 
                refKey: "refpk",
                dtoKey: "activityFeeTypeId",
                layer: ["childTableColumn", "activityDetails", "column"],
                fields: ["advertisingMediaName",]
            },{ 
                value: "1001A810000000006SOA,1001A810000000006SOB", 
                refKey: "refpk",
                dtoKey: "activityFeeTypeId",
                layer: ["childTableColumn", "activityDetails", "column"],
                fields: ["basePrice"]
            },{
                value: "1001A810000000008DQ9",
                refKey: "refpk",
                dtoKey: "activityFeeTypeId",
                layer: ["childTableColumn", "activityDetails", "column"],
                fields: ["siteFeeTypeName", "lastAdjustmentDate", "expectAdjustmentDate", "lastRetailAmount", "yearlyBudget"]
            },{
                value: "00107,00108,00901",//决裁名称为价格申请、客户退换货的隐藏表头部分字段
                refKey: "refcode",
                dtoKey: "activityFeeTypeCode",
                hideFlag:true,
                layer: ["FormField", "DataHeader", "Field"],
                fields: ["planSaleAmount","planSaleNum","planCostAmount", "planCostAmount2"]
            },{
                value: "00107",//决裁名称为价格申请的隐藏表体部分字段
                refKey: "refcode",
                dtoKey: "activityFeeTypeCode",
                hideFlag:true,
                layer: ["childTableColumn", "activityDetails", "column"],
                fields: ["occurMonth", "activityStartDate", "activityEndDate", "customerName", "planSaleAmount", "planSaleNum", "planCostAmount", "companyUnitCost", "costRate", "brief"]
            },{
                value: "00108,00901",//决裁名称为客户退换货的隐藏表体
                refKey: "refcode",
                dtoKey: "activityFeeTypeCode",
                hideFlag:true,
                layer: ["childTableColumn", "activityDetails"],
                fields: "all"
            },{
                value: "00108",//决裁名称为客户退换货的隐藏表体
                refKey: "refcode",
                dtoKey: "activityFeeTypeCode",
                hideFlag:true,
                layer: ["childTableColumn", "activityConnects"],
                fields: "all"
            }
        ],
        requirecontrol:[{
                value: "1001A11000000001IAFR,1001A810000000006SOA,1001A810000000006SOB",
                refKey: "refpk",
                dtoKey: "activityFeeTypeId",
                layer: ["childTableColumn", "activityDetails", "column"],
                fields: ["shopName"]
            },{
                value: "1001A810000000006SO5,1001A81000000000ANK0",
                refKey: "refpk",
                dtoKey: "activityFeeTypeId",
                layer: ["childTableColumn", "activityDetails", "column"],
                fields: ["planCostAmount2","planSaleAmount"]
            },
            {
                value: "1001A810000000006SO2,1001A810000000006SO3,1001A810000000006SO4,1001A81000000000ANK0,1001A11000000001QCGR,1001A1100000000UPOMT,1001A810000000006SO7,1001A1100000000UPOOR,1001A1100000000UPOOZ,1001A1100000000UPOP7",
                refKey: "refpk",
                dtoKey: "activityFeeTypeId",
                layer: ["childTableColumn", "activityDetails", "column"],
                fields: ["customerName"]
            },
        ],
        edit: true,
        required: true,
    },
    {
        enname: "adjudicationTypeId",
        codename: "adjudicationTypeCode",
        showname: "adjudicationTypeName",
        zhname: "决裁类型",
        type: "RefComponent",
        // alias:"activityFeeTypeId",
        refname: "defdoc",
        edit: false,
        required: false,
    },
    {
        enname: "saleStatisticBasisId",
        codename: "saleStatisticBasisCode",
        showname: "saleStatisticBasisName",
        zhname: "销量统计依据",
        code: "SALE_STATISTIC_BASIS",
        type: "Select",
        edit: true,
        // showcontrol:[
        //     {
        //         value: "01,03",
        //         refKey: "code",
        //         dtoKey: "isEnable",
        //         layer: ["FormField", "DataHeader", "Field"],
        //         fields: ["ext07"]
        //     },
        // ],
        hidepage:{0:true},
        required: true,
    },
    {
        enname: "ext07Id",
        codename: "ext07Code",
        showname: "ext07Name",
        zhname: "客户统计依据",
        code: "CUSTOMER_STATISTICS",
        type: "Select",
        edit: true,
        required: true,
    },
    {
        enname: "reportAreaId",
        codename: "reportAreaCode",
        showname: "reportAreaName",
        zhname: "部门片区",
        type: "RefComponent",
        alias:"organizationId",
        param:{
            "AUTH_refdim": "marketarea", 
            "AUTH_refcod": "ActivityScheme"
        },
        refname: "departmentRef",
        edit: true,
        required:true,
    },
    {
        enname: "reportPersonId",
        codename: "reportPersonCode",
        showname: "reportPersonName",
        zhname: "起案人",
        type: "RefComponent",
        refname: "personRef",
        hidepage:{0:true},
        edit: false,
    },
    {
        enname: "ext09Id",
        showname: "ext09Name",
        codename: "ext09Code",
        zhname: "协同组织",
        type: "RefComponent",
        refname: "organization",
        edit: true,
        cascadeName: [{
            paramkey: "EQ_organization.id",
            childtype: "DataHeader",
            refKey: "refpk",
            dtoKey: "organizationId",
            offers: "ext17Id",
            resetOffersFlag: true,
        },],
        hidepage: { 0: true, 1: true, 3: true},
        required: true,
    },
    {
        enname: "ext17Id",
        showname: "ext17Name",
        codename: "ext17Code",
        zhname: "协同部门",
        type: "RefComponent",
        refname: "departmentRef",
        edit: true,
        hidepage: { 0: true, 1: true, 3: true},
        alias:"ext09Id",
        required: true,
    },
    {
        enname: "reportDate",
        zhname: "起案日期",
        defaultValue:moment(),
        type: "DatePicker",
        format: "YYYY-MM-DD",
        edit: false,
    },
    {
        enname: "expectedFinishDate",
        zhname: "期望办结日期",
        type: "DatePicker",
        format: "YYYY-MM-DD",
        edit: true,
        hidepage: { 0: true,1: true },
        required:true,
    },
    {
        enname: "planSaleAmount",
        zhname: "计划销售额合计",
        precision: 2,
        // hidepage: { 0: true },
        type: "InputNumber",
        // edit: true,
    },
    {
        enname: "planCostAmount",
        zhname: "计划报销额合计",
        precision: 2,
        // hidepage: { 0: true },
        type: "InputNumber",
        // edit: true,
    },
    {
        enname: "planCostAmount2",
        zhname: "计划费用额合计",
        precision: 2,
        // hidepage: { 0: true },
        type: "InputNumber",
        // edit: true,
    },
    {
        enname: "actualCostAmount",
        zhname: "实际报销额合计",
        precision: 2,
        hidepage: { 0: true },
        type: "InputNumber",
        // edit: true,
    },
    {
        enname: "actualSaleAmount",
        zhname: "实际销售额合计",
        precision: 2,
        hidepage: { 0: true },
        type: "InputNumber",
        // edit: true,
    },
    {
        enname: "actualCostAmount1",
        zhname: "实际费用额合计",
        precision: 2,
        hidepage: { 0: true },
        type: "InputNumber",
        // edit: true,
    },
    {
        enname: "theoreticalCostAmount",
        zhname: "更新费用额合计",
        precision: 2,
        hidepage: { 0: true },
        type: "InputNumber",
        // edit: true,
    },
    {
        enname: "theoreticalReimburseAmount",
        zhname: "更新报销额合计",
        precision: 2,
        hidepage: { 0: true },
        type: "InputNumber",
        // edit: true,
    },
    {
        enname: "planSaleNum",
        zhname: "数量",
        precision: 2,
        // hidepage: { 0: true },
        type: "InputNumber",
        // edit: true,
    },
    
    
    {
        enname: "confirmationAmount",
        zhname: "确认金额合计",
        precision: 2,
        hidepage: { 0: true },
        type: "InputNumber",
        edit: false,
    },
    {
        enname: "reimbursementAmount",
        zhname: "报销金额合计",
        precision: 2,
        hidepage: { 0: true },
        type: "InputNumber",
        edit: false,
    },
    {
        enname: "yconfirmationAmount",
        zhname: "可确认金额",
        precision: 2,
        hidepage: { 0: true },
        type: "InputNumber",
        edit: false,
    },
    {
        enname: "ext08",
        zhname: "单据来源",
        type: "FormControl",
        edit: false,
    },
    {
        enname: "ext04",
        zhname: "来源单据号",
        type: "FormControl",
        hidepage: { 0: true, 1: true},
        edit: true,
    },
    {
        enname: "ext02",
        zhname: "是否失效",
        type: "Radio",
        options: [
            {
                value: '失效', key: "1"
            },
            {
                value: '有效', key: "0"
            },
        ],
        required: false,
        hidepage: { 0: true,1:true,2:false },
        edit: false,
    },
    {
        enname: "creationTime",
        zhname: "创建日期",
        type: "DatePicker",
        required: false,
        format: "YYYY-MM-DD",
        hidepage: { 0: true },
        edit: false,
    },
    {
        enname: "modifiedTime",
        zhname: "编辑日期",
        type: "DatePicker",
        format: "YYYY-MM-DD",
        required: false,
        hidepage: { 0: true },
        edit: false,
    },
    {
        enname: "modifierName",
        zhname: "编辑人",
        type: "FormControl",
        required: false,
        hidepage: { 0: true },
        edit: false,
    },
    {
        enname: "billStatusId",
        codename: "billStatusCode",
        showname: "billStatusName",
        zhname: "审批状态",
        type: "Select",
        hidepage: { 0: true },
        code: "BILL_STATUS",
        required: false,
        edit: false,
    },
    {
        enname: "approver",
        zhname: "审批人",
        type: "FormControl",
        required: false,
        hidepage: { 0: true },
        edit: false,
    },
    {
        enname: "approveTime",
        zhname: "审批日期",
        type: "DatePicker",
        format: "YYYY-MM-DD",
        required: false,
        hidepage: { 0: true },
        edit: false,
    },
    {
        enname: "remark",
        zhname: "摘要",
        type: "FormControl",
        required: false,
        componentClass: "textarea",
        message: "不能有空格",
        pattern:/^\S*$/,
        edit: true,
    },
    {
        enname: "ext06",
        zhname: "更新时间",
        type: "FormControl",
        required: false,
        hidepage: { 0:true},
        edit: false,
    },
    {
        enname: "isEnable",
        zhname: "启用状态",
        type: "Radio",
        hidepage: { 0: true },
        options: [{
            "key": 1,
            "value": "已启用"
        }, {
            "key": 2,
            "value": "停用"
        }],
        showcontrol:[
            {
                value: "2",
                refKey: "code",
                dtoKey: "isEnable",
                layer: ["FormField", "DataHeader", "Field"],
                fields: ["stopUserId","disableDate","stopCause"]
            },
        ],
        edit: false,
    },
    {
        enname: "stopUserId",
        codename: "stopUserCode",
        showname: "stopUserName",
        zhname: "停用人",
        edit: false,
        type: "RefComponent",
        hidepage:{0:true},
        refname: "personRef",
    },
    {
        enname: "disableDate",
        zhname: "停用日期",
        type: "DatePicker",
        required: false,
        format: "YYYY-MM-DD",
        hidepage: { 0: true },
        edit: false,
    },
    {
        enname: "stopCause",
        zhname: "停用原因",
        type: "FormControl",
        required: false,
        componentClass: "textarea",
        pattern: /^\S*$/,
        message: "不能有空格",
        hidepage: { 0: true },
        edit: false,
    },
    {
        enname: "ext12",
        zhname: "同期门店规模",
        precision: 2,
        hidepage: { 0: true },
        type: "InputNumber",
        required: true,
        edit: true,
    },
    {
        enname: "ext13",
        zhname: "同期松下规模",
        precision: 2,
        hidepage: { 0: true },
        type: "InputNumber",
        required: true,
        edit: true,
    },
    {
        enname: "ext14",
        zhname: "同期松下占比",
        precision: 2,
        except:0,
        min: 0,
        max: 100,
        hidepage: { 0: true },
        type: "InputNumber",
        required: true,
        edit: true,
    },
    {
        enname: "ext15",
        zhname: "预计松下规模",
        precision: 2,
        hidepage: { 0: true },
        type: "InputNumber",
        required: true,
        edit: true,
    },
    {
        enname: "ext16",
        zhname: "预计松下占比",
        precision: 2,
        except:0,
        min: 0,
        max: 100,
        hidepage: { 0: true },
        type: "InputNumber",
        required: true,
        edit: true,
    },
]

const columnactivityConnects = [
    {
        title: "下游单据名称",
        dataIndex: "downStreamName1",
        key: "downStreamName1",
        detailwidth: 100,
    },
    {
        title: "下游单据号",
        dataIndex: "downStreamBillCode1",
        key: "downStreamBillCode1",
        detailwidth: 150,
        render:(text,record) => {
            if (record.downStreamName1==="费用确认单") {
                return <a 
                value="ExpenseConfirmation" 
                name="费用确认单"
                onClick = {(e)=>{
                    e.preventDefault();//阻止默认事件
                    window.top.handleClick(e,1);//调用打开新页签方法
                }}
                href={encodeURIComponent(encodeURIComponent(`/fmcg-web-react/OrderFish#/ExpenseConfirmation-edit?search_id=${record.ext01}&btnPageFlag=${2}`))} >
                {text}
            </a> 
            }else if (record.downStreamName1==="决裁总结单") {
                return <a 
                value="ExpenseSum" 
                name="决裁总结单"
                onClick = {(e)=>{
                    e.preventDefault();//阻止默认事件
                    window.top.handleClick(e,1);//调用打开新页签方法
                }}
                href={encodeURIComponent(encodeURIComponent(`/fmcg-web-react/OrderFish#/ExpenseSum-edit?search_id=${record.ext01}&btnPageFlag=${2}`))} >
                {text}
            </a> 
            }else {
                return <a 
                value="ActivityProgram" 
                name="决裁申请单"
                onClick = {(e)=>{
                    e.preventDefault();//阻止默认事件
                    window.top.handleClick(e,1);//调用打开新页签方法
                }}
                href={encodeURIComponent(encodeURIComponent(`/fmcg-web-react/OrderFish#/ActivityProgram-edit?search_id=${record.ext01}&btnPageFlag=${2}`))} >
                {text}
            </a> 
            }
        }
    },
    {
        title: "单据日期",
        dataIndex: "ext03",
        key: "ext03",
        detailwidth: 150,
        render: (text, record, index) => {
            return text && ts2Formatter(text,1);
        }
    },
    {
        title: "客户",
        dataIndex: "ext08",
        key: "ext08",
        detailwidth: 150,
    },
    {
        title: "单据金额",
        dataIndex: "ext04",
        key: "ext04",
        detailwidth: 80,
    },
    {
        title: "部门片区",
        dataIndex: "ext05",
        key: "ext05",
        detailwidth: 100,
    },
    {
        title: "单据状态",
        dataIndex: "ext06",
        key: "ext06",
        detailwidth: 100,
        render: (text, record, index) => {
            if (text=="0") {
                return "自由";
            }else if (text=="1") {
                return "提交";
            }else if (text=="2") {
                return "审核中";
            }else if (text=="3") {
                return "审核通过";
            }
        }
    },
    {
        title: "启停状态",
        dataIndex: "ext09",
        key: "ext09",
        detailwidth: 80,
        render: (text, record, index) => {
            if (text=="1") {
                return "启用";
            }else if (text=="2") {
                return "停用";
            }
        }
    },
    {
        title: "制单人",
        dataIndex: "ext07",
        key: "ext07",
        detailwidth: 150,
    },
]

const columnactivityBudgets = [
    {
        title: "预算方案",
        dataIndex: "budgetPlanCode",
        key: "budgetPlanCode",
        detailwidth: 120,
        render:(text,record) => {
            return <a 
                value="BudgetPlan" 
                name="预算方案"
                onClick = {(e)=>{
                    e.preventDefault();//阻止默认事件
                    window.top.handleClick(e,1);//调用打开新页签方法
                }}
                href={encodeURIComponent(encodeURIComponent(`/fmcg-web-react/OrderFish#/BudgetPlan-edit?search_id=${record.budgetPlanId}&btnPageFlag=${2}`))} >
                {text}
            </a> 
        }
    },    
    {
        title: "预算优先级",
        dataIndex: "budgetPriority",
        key: "budgetPriority",
        detailwidth: 80,
    },
    {
        title: "公司",
        dataIndex: "saleOrgName",
        key: "saleOrgName",
        detailwidth: 80,
    },
    {
        title: "部门",
        dataIndex: "departmentName",
        key: "departmentName",
        detailwidth: 70,
    },
    {
        title: "客户",
        dataIndex: "customerName",
        key: "customerName",
        detailwidth: 150,
    },
    {
        title: "渠道",
        dataIndex: "channelName",
        key: "channelName",
        detailwidth: 50,
    },
    {
        title: "门店",
        dataIndex: "terminalStoreName",
        key: "terminalStoreName",
        detailwidth: 150,
    },
    {
        title: "预算总额",
        dataIndex: "budgetAmount",
        key: "budgetAmount",
        detailwidth: 70,
    },
    {
        title: "预算余额",
        dataIndex: "surplusAmount",
        key: "surplusAmount",
        detailwidth: 70,
    },
    {
        title: "剩余预算余额",
        dataIndex: "budgetBalance",
        key: "budgetBalance",
        detailwidth: 80,
    },
    {
        title: "预算费用率",
        dataIndex: "budgetRate",
        key: "budgetRate",
        detailwidth: 70,
    },
    {
        title: "超预算率",
        dataIndex: "overBudgetRate",
        key: "overBudgetRate",
        detailwidth: 50,
    },
]

const columnactivitySchemeAttachments = [
    {
        title: "标题",
        dataIndex: "filename",
        key: "filename",
        detailwidth: 250,
    }, {
        title: "上传时间",
        dataIndex: "creationTime",
        key: "creationTime",
        detailwidth: 150,
        render: (text, record, index) => {
            return text && ts2Formatter(text,1);
        }
    },
    {
        title: "缩略图",
        dataIndex: "fileUrl",
        key: "fileUrl",
        width: 150,
        render: (text, record, index) => {
            if(record.fileUrl.search("jpg") != -1 || record.fileUrl.search("jpeg") != -1 ||record.fileUrl.search("png") != -1){
                return <span>
                <img style={{"width":"35px"}} src={text} />
             </span>
            }else {
                return ""
            }
            
        }
    }, 
    {
        title: "创建人",
        dataIndex: "creatorname",
        key: "creatorname",
        width: 150,
    }
]

const colummactivitySchemeExpenses = [
    {
        title: "客户",
        dataIndex: "customerName",
        key: "customerId",
        renderType: "refcomponent",
        width: 250,
        // validate: false,
        // required: true,
        hideFlag:true,
        filedProps: {
            title: "客户",
            refName: "terminalcustomerRef",
            constparam:{
                "AUTH_refdim": "customer", 
                "AUTH_refcod": "ActivityScheme"
            },
            aliasparam: [{
                paramkey: "EQ_customerAreas.organization.id",
                alias: "organizationId",
            }],
            offersparam: {
                currentkey: ["custChanTypeId","custChanTypeName","custChanTypeCode"],
                offerfields: ["channelTypeId","channelTypeName","channelTypeCode"],
            },
            fieldName: "customerName",
            reffields: { refpk: "customerId", refname: "customerName", refcode: "customerCode" }
        },
    },
    {
        title: "渠道",
        dataIndex: "channelTypeName",
        key: "channelTypeId",
        renderType: "refcomponent",
        width: 150,
        validate: false,
        required: true,
        filedProps: {
            title: "渠道",
            refName: "custchantype",
            constparam:{
                "AUTH_refdim": "custchantype", 
                "AUTH_refcod": "ActivityProgram",
                "EQ_enableState": "1",
            },
            fieldName: "channelTypeName",
            reffields: { refpk: "channelTypeId", refname: "channelTypeName", refcode: "channelTypeCode" }
        },
    },
    // {
    //     title: "商品型号",
    //     dataIndex: "goodsModelName",
    //     key: "goodsModelId",
    //     renderType: "refcomponent",
    //     width: 150,
    //     validate: false,
    //     required: true,
    //     filedProps: {
    //         title: "品类",
    //         refName: "goodsRef",
    //         fieldName: "goodsModelName",
    //         reffields: { refpk: "goodsModelId", refname: "goodsModelName", refcode: "goodsModelCode" }
    //     },
    // },
    // {
    //     title: "单价(元/台)",
    //     dataIndex: "unitPrice",
    //     key: "unitPrice",
    //     renderType: "inputnumber",
    //     width:110,
    //     filedProps: {
    //         precision: 2,
    //         except:0,
    //         min: 0,
    //     }
    // },
    {
        title: "计划销售台量(台)",
        dataIndex: "planSaleNum",
        key: "planSaleNum",
        renderType: "inputnumber",
        width:110,
        filedProps: {
            precision: 2,
            except:0,
            min: 0,
        }
    },
    {
        title: "计划销售额(元)",
        dataIndex: "planSaleAmount",
        key: "planSaleAmount",
        renderType: "inputnumber",
        width:110,
        filedProps: {
            precision: 2,
            except:0,
            min: 0,
        }
    },
    {
        title: "折让-单台(元/台)",
        dataIndex: "discountSingle",
        key: "discountSingle",
        renderType: "inputnumber",
        width:110,
        filedProps: {
            precision: 2,
            except:0,
            min: 0,
        }
    },
    {
        title: "折让-单台追加(元/台)",
        dataIndex: "discountSingleAppend",
        key: "discountSingleAppend",
        renderType: "inputnumber",
        width:110,
        filedProps: {
            precision: 2,
            except:0,
            min: 0,
        }
    },
    {
        title: "折让-销售费用%",
        dataIndex: "discountSaleCost",
        key: "discountSaleCost",
        renderType: "inputnumber",
        width:110,
        filedProps: {
            precision: 2,
            except:0,
            min: 0,
            max:100
        }
    },
    {
        title: "折让-预留费用%",
        dataIndex: "discountReserveCost",
        key: "discountReserveCost",
        renderType: "inputnumber",
        width:110,
        filedProps: {
            precision: 2,
            except:0,
            min: 0,
            max:100
        }
    },
    {
        title: "折让-小计(元）",
        dataIndex: "discountTotal",
        key: "discountTotal",
        // renderType: "inputnumber",
        width:110,
        filedProps: {
            precision: 2,
            except:0,
            min: 0,
        }
    },
    {
        title: "薪资-带单(元/台）",
        dataIndex: "salaryWithOrder",
        key: "salaryWithOrder",
        renderType: "inputnumber",
        width:110,
        filedProps: {
            precision: 2,
            except:0,
            min: 0,
        }
    },
    {
        title: "薪资-变动提成(元/台）",
        dataIndex: "salaryTransferCommission",
        key: "salaryTransferCommission",
        renderType: "inputnumber",
        width:110,
        filedProps: {
            precision: 2,
            except:0,
            min: 0,
        }
    },
    {
        title: "薪资-销售激励%",
        dataIndex: "salarySaleInspire",
        key: "salarySaleInspire",
        renderType: "inputnumber",
        width:110,
        filedProps: {
            precision: 2,
            except:0,
            min: 0,
            max:100
        }
    },
    {
        title: "薪资-小计(元）",
        dataIndex: "salaryTotal",
        key: "salaryTotal",
        // renderType: "inputnumber",
        width:110,
        filedProps: {
            precision: 2,
            except:0,
            min: 0,
        }
    },
    {
        title: "电汇-单台激励(元/台)",
        dataIndex: "wireSingleInspire",
        key: "wireSingleInspire",
        renderType: "inputnumber",
        width:110,
        filedProps: {
            precision: 2,
            except:0,
            min: 0,
        }
    },
    {
        title: "电汇-销售激励%",
        dataIndex: "wireSaleInspire",
        key: "wireSaleInspire",
        renderType: "inputnumber",
        width:110,
        filedProps: {
            precision: 2,
            except:0,
            min: 0,
            max:100
        }
    },
    {
        title: "电汇-小计(元）",
        dataIndex: "wireTransfer",
        key: "wireTransfer",
        // renderType: "inputnumber",
        width:110,
        filedProps: {
            precision: 2,
            except:0,
            min: 0,
        }
    },
    {
        title: "计划费用额合计",
        dataIndex: "planCostAmountTotal",
        key: "planCostAmountTotal",
        // renderType: "inputnumber",
        width:110,
        filedProps: {
            precision: 2,
            except:0,
            min: 0,
        }
    },
    {
        title: "计划费用率%",
        dataIndex: "planCostRate",
        key: "planCostRate",
        // renderType: "inputnumber",
        width:110,
        filedProps: {
            precision: 2,
            except:0,
            min: 0,
        }
    },
    {
        title: "计划报销额合计(元)",
        dataIndex: "planReimburseAmount",
        key: "planReimburseAmount",
        // renderType: "inputnumber",
        width:110,
        filedProps: {
            precision: 2,
            except:0,
            min: 0,
        }
    }
]





const columactivityDetails = [
    // {
    //     title: "行号",
    //     dataIndex: "rowNum",
    //     key: "rowNum",
    //     width:100,
    // },
    {
        dataIndex: "occurMonth",
        key: "occurMonth",
        title: "归属年份",
        width: 110,
        renderType: "datepicker",
        required: true,
        render: (text, record, index) => {
            return new Date(text).getFullYear()+'-'+(new Date(text).getMonth()+1);
        },
        filedProps: {
            disabledDate: "occurMonth",
            format: "YYYY-MM",
        }
    },
    {
        title: "活动开始日期",
        dataIndex: "activityStartDate",
        key: "activityStartDate",
        renderType: "datepicker",
        required: true,
        width: 110,
        render: (text, record, index) => {
            return text && ts2Formatter(text);
        },
        filedProps: {
            format: "YYYY-MM-DD",
        }
    },
    {
        title: "活动结束日期",
        dataIndex: "activityEndDate",
        key: "activityEndDate",
        renderType: "datepicker",
        required: true,
        width: 110,
        render: (text, record, index) => {
            return text && ts2Formatter(text);
        },
        filedProps: {
            disabledDate: "activityStartDate",
            format: "YYYY-MM-DD",
        }
    },
    {
        title: "门店",
        dataIndex: "shopName",
        key: "shopId",
        renderType: "refcomponent",
        width: 110,
        validate: false,
        required: false,
        filedProps: {
            title: "门店",
            refName: "terminal",
            aliasparam: [{
                paramkey: "EQ_organization.id",
                alias: "organizationId",
            }],
            offersparam: {
                currentkey: ["customerId","customerName","customerCode","custChanTypeId","custChanTypeName","custChanTypeCode"],
                offerfields: ["customerId","customerName","customerCode","channelTypeId","channelTypeName","channelTypeCode"],
            },
            fieldName: "shopName",
            reffields: { refpk: "shopId", refname: "shopName", refcode: "shopCode" }
        },
    },
    {
        title: "客户",
        dataIndex: "customerName",
        key: "customerId",
        renderType: "refcomponent",
        width: 250,
        // validate: false,
        // required: true,
        hideFlag:true,
        filedProps: {
            title: "客户",
            refName: "terminalcustomerRef",
            constparam:{
                "AUTH_refdim": "customer", 
                "AUTH_refcod": "ActivityScheme",
                "EQ_isFrozen": "0"
            },
            aliasparam: [{
                paramkey: "EQ_customerAreas.organization.id",
                alias: "organizationId",
            }],
            offersparam: {
                currentkey: ["custChanTypeId","custChanTypeName","custChanTypeCode"],
                offerfields: ["channelTypeId","channelTypeName","channelTypeCode"],
            },
            fieldName: "customerName",
            reffields: { refpk: "customerId", refname: "customerName", refcode: "customerCode" }
        },
    },
    {
        title: "渠道",
        dataIndex: "channelTypeName",
        key: "channelTypeName",
        renderType: "refcomponent",
        width: 140,
        validate: false,
        required: true,
        filedProps: {
            title: "渠道",
            constparam:{
                "AUTH_refdim": "channelType", 
                "AUTH_refcod": "ActivityScheme",
                "EQ_enableState": "1",
            },
            refName: "custchantype",
            fieldName: "channelTypeName",
            reffields: { refpk: "channelTypeId", refname: "channelTypeName", refcode: "channelTypeCode" }
        },
    },
    // {
    //     title: "销售类型",
    //     dataIndex: "saleTypeCode",
    //     key: "saleTypeCode",
    //     renderType: "select",
    //     width: 100,
    //     filedProps: {
    //         reffields: { refpk: "saleTypeId", refname: "saleTypeName", refcode: "saleTypeCode" },
    //         options: [
    //             {
    //                 name: '正常机', code: "01", id: "0CHGSH6gs1gdv6I87ML9"
    //             },
    //             {
    //                 name: '特价机', code: "02", id: "0OSFSXyPTvenR3RDbpy5"
    //             },
    //         ]
    //     },
    //     edit: true,
    //     required: false,
    // },
    {
        title: "计划销售额",
        dataIndex: "planSaleAmount",
        key: "planSaleAmount",
        width: 110,
        // validate: false,
        // required: true,
        renderType: "inputnumber",
        filedProps: {
            precision: 2,
            // except:0,
            // min: 0,
        }
    },
    {
        dataIndex: "planSaleNum",
        key: "planSaleNum",
        title: "数量",
        renderType: "inputnumber",
        edit: true,
        width: 110,
        // required:true,
        filedProps: {
            precision: 2,
            // min: 0,
        },
        edit: true,
    },
    {
        dataIndex: "giftAmount",
        key: "giftAmount",
        title: "赠品金额",
        width: 110,
        renderType: "inputnumber",
        edit: true,
        filedProps: {
            precision: 2,
            min: 0,
        },
        edit: true,
        required: false,
    },
    {
        dataIndex: "planCostAmount",
        key: "planCostAmount",
        title: "计划报销额",
        width: 110,
        renderType: "inputnumber",
        filedProps: {
            precision: 2,
            // min: 0,
        },
        edit: true,
        validate:false,
        required: true,
    },
    {
        dataIndex: "planCostAmount2",
        key: "planCostAmount2",
        title: "计划费用额",
        width: 110,
        renderType: "inputnumber",
        filedProps: {
            precision: 2,
            // min: 0,
        },
        edit: true,
        validate:false,
    },
    {
        dataIndex: "costRate",
        key: "costRate",
        title: "费用率%",
        width: 110,
        // renderType: "inputnumber",
        // edit: true,
        // filedProps: {
        //     precision: 2,
        //     min: 0,
        // },
        // edit: true,
        // required: false,
    },
    // {
    //     dataIndex: "singleCost",
    //     key: "singleCost",
    //     title: "单台费用",
    //     width:110,
    //     renderType: "inputnumber",
    //     edit: true,
    //     filedProps: {
    //         precision: 2,
    //         min: 0,
    //     },
    //     edit: true,
    //     required: false,
    // },
    {
        dataIndex: "confirmationAmount",
        key: "confirmationAmount",
        title: "确认金额",
        width: 100,
        hidepage: { 0: true },
    },
    {
        dataIndex: "yconfirmationAmount",
        key: "yconfirmationAmount",
        title: "可确认金额",
        width: 100,
        hidepage: { 0: true },
        // renderType: "inputnumber",
        // edit: true,
        // filedProps: {
        //     precision: 2,
        //     min: 0,
        // },
        // edit: true,
        // required: false,
    },
    {
        dataIndex: "reimbursementAmount",
        key: "reimbursementAmount",
        title: "报销金额",
        width: 110,
        hidepage: { 0: true },
        // renderType: "inputnumber",
        // edit: true,
        // filedProps: {
        //     precision: 2,
        //     min: 0,
        // },
        // edit: true,
        // required: false,
    },
    {
        dataIndex: "actualCostAmount",
        key: "actualCostAmount",
        title: "实际报销额",
        width: 110,
        // renderType: "inputnumber",
        edit: true,
        filedProps: {
            precision: 2,
            except:0,
            min: 0,
        },
        hidepage: { 0: true },
        required: false,
    },
    {
        dataIndex: "actualCostAmount1",
        key: "actualCostAmount1",
        title: "实际费用额",
        width: 110,
        // renderType: "inputnumber",
        edit: true,
        filedProps: {
            precision: 2,
            except:0,
            min: 0,
        },
        hidepage: { 0: true },
        required: false,
    },
    {
        dataIndex: "ext03",
        key: "ext03",
        title: "实际销售台量",
        width: 110,
        // renderType: "inputnumber",
        edit: true,
        filedProps: {
            precision: 2,
            except:0,
            min: 0,
        },
        hidepage: { 0: true },
        required: false,
    },
    {
        dataIndex: "actualSaleAmount",
        key: "actualSaleAmount",
        title: "实际销售额",
        width: 110,
        // renderType: "inputnumber",
        edit: true,
        filedProps: {
            precision: 2,
            except:0,
            min: 0,
        },
        hidepage: { 0: true },
        required: false,
    },
    {
        dataIndex: "companyUnitCost",
        key: "companyUnitCost",
        title: "公司单台费用合计(零售)",
        width: 110,
        // renderType: "inputnumber",
        edit: true,
        filedProps: {
            precision: 2,
            except:0,
            min: 0,
        },
        hidepage: { 0: true },
        required: false,
    },
    {
        dataIndex: "theoreticalCostAmount",
        key: "theoreticalCostAmount",
        title: "更新费用额",
        width: 110,
        hidepage: { 0: true},
        // renderType: "inputnumber",
        // edit: true,
        // filedProps: {
        //     precision: 2,
        //     min: 0,
        // },
        required: false,
    },
    {
        dataIndex: "theoreticalReimburseAmount",
        key: "theoreticalReimburseAmount",
        title: "更新报销额",
        width: 110,
        hidepage: { 0: true },
        // renderType: "inputnumber",
        // edit: true,
        // filedProps: {
        //     precision: 2,
        //     min: 0,
        // },
        required: false,
    },
    {
        dataIndex: "brief",
        key: "brief",
        title: "备注",
        renderType: "input",
        pattern:/^\S*$/,
        patternMessage: "不能有空格",
        edit: true,
        filedProps: {
            maxLenght: 20,
        },
        required: false,
    },
    // {
    //     title: "门店",
    //     dataIndex: "shopName",
    //     key: "shopId",
    //     renderType: "refcomponent",
    //     width: 110,
    //     validate: false,
    //     required: true,
    //     filedProps: {
    //         title: "门店",
    //         refName: "terminal",
    //         fieldName: "shopName",
    //         reffields: { refpk: "shopId", refname: "shopName", refcode: "shopCode" }
    //     },
    // },
    // {
    //     dataIndex: "giftTotalAmount",
    //     key: "giftTotalAmount",
    //     title: "赠品总额",
    //     width: 110,
    //     renderType: "inputnumber",
    //     edit: true,
    //     filedProps: {
    //         precision: 2,
    //         min: 0,
    //     },
    //     required: false,
    // },
    {
        title: "广告媒体",
        dataIndex: "advertisingMediaName",
        key: "advertisingMediaId",
        renderType: "refcomponent",
        width: 110,
        validate: false,
        required: true,
        filedProps: {
            title: "广告媒体",
            refName: "terminalGmt",
            fieldName: "advertisingMediaName",
            reffields: { refpk: "advertisingMediaId", refname: "advertisingMediaName", refcode: "advertisingMediaCode" }
        },
    },
    {
        title: "费用科目",
        dataIndex: "expenseBusiTypeName",
        key: "expenseBusiTypeId",
        renderType: "refcomponent",
        width: 110,
        validate: false,
        required: true,
        filedProps: {
            title: "费用科目",
            refName: "feeType",
            constparam:{
                "EQ_enableState": "1"
            },
            fieldName: "expenseBusiTypeName",
            reffields: { refpk: "expenseBusiTypeId", refname: "expenseBusiTypeName", refcode: "expenseBusiTypeCode" }
        },
    },
    {
        title: "公司承担额",
        dataIndex: "companyResponsibilityAmount",
        key: "companyResponsibilityAmount",
        renderType: "inputnumber",
        edit: true,
        filedProps: {
            precision: 2,
            min: 0,
        },
        required: false,
    },
    {
        title: "单价",
        dataIndex: "basePrice",
        key: "basePrice",
        renderType: "inputnumber",
        edit: true,
        filedProps: {
            precision: 2,
            min: 0,
        },
        required: false,
    },
    {
        title: "场地费类别",
        dataIndex: "siteFeeTypeName",
        key: "siteFeeTypeId",
        renderType: "refcomponent",
        width: 110,
        filedProps: {
            title: "场地费类别",
            refName: "terminalCdf",
            fieldName: "siteFeeTypeName",
            reffields: { refpk: "siteFeeTypeId", refname: "siteFeeTypeName", refcode: "siteFeeTypeCode" }
        },
    },
    {
        title: "上次调整日期",
        dataIndex: "lastAdjustmentDate",
        key: "lastAdjustmentDate",
        renderType: "datepicker",
        width: 110,
        filedProps: {
            format: "YYYY-MM-DD"
        },
    },
    {
        title: "预计调整日期",
        dataIndex: "expectAdjustmentDate",
        key: "expectAdjustmentDate",
        renderType: "datepicker",
        width: 110,
        filedProps: {
            format: "YYYY-MM-DD"
        },
    },
    {
        title: "上期零售额",
        dataIndex: "lastRetailAmount",
        key: "lastRetailAmount",
        renderType: "inputnumber",
        edit: true,
        filedProps: {
            precision: 2,
            min: 0,
        },
        required: false,
    },
    {
        title: "年度预算",
        dataIndex: "yearlyBudget",
        key: "yearlyBudget",
        renderType: "inputnumber",
        edit: true,
        filedProps: {
            precision: 2,
            min: 0,
        },
        required: false,
    },
    // {
    //     dataIndex: "attributionYear",
    //     key: "attributionYear",
    //     title: "归属年份",
    //     renderType: "datepicker",
    //     required:true,
    //     render: (text, record, index) => {
    //         return text && ts2Formatter(text);
    //     },
    //     filedProps: {
    //         disabledDate:"attributionYear",
    //         format:"YYYY",
    //     }
    // }
]
//表单字段

export const FormField = {
    "DataHeader": {
        "title": "基础信息",
        "Field": FormDataHeader
    },
}

//表格弹框表单字段
export const FormTableField = {
}

//渲染成字表表格的头
export const childTableColumn = {
    "activityDetails": {
        "title": "决裁明细",
        "type": "grid",
        "column": columactivityDetails
    },
    // "activitySchemeExpenses": {
    //     "title": "活动方案",
    //     "type": "grid",
    //     "column": colummactivitySchemeExpenses
    // },
    "activityConnects": {
        "title": "决裁关联",
        "type": "grid",
        "column": columnactivityConnects
    },
    "activitySchemeBudgets": {
        "title": "预算明细",
        "type": "grid",
        "column": columnactivityBudgets
    },
    "activitySchemeAttachments": {
        "title": "附件",
        "type": "grid",
        "column": columnactivitySchemeAttachments
    },
}

//渲染成字表表格的头
export const mainTableColumn = [
    {
        title: "单据号",
        dataIndex: "billCode",
        width: 130,
        key: "billCode",
        render: (text, record) => {
            return <a style={{ "cursor": "pointer" }}
                onClick={() => {
                    actions.routing.push(
                        {
                            pathname: 'ActivityProgram-edit',
                            search: `?search_id=${record.id}&btnPageFlag=2`,
                        }
                    );
                    // location.reload();
                }}
            >
                {text}
            </a >;
        }
    },
    {
        title: "隶属组织",
        dataIndex: "organizationName",
        key: "organizationName",
    },
    {
        title: "决裁名称",
        dataIndex: "activityFeeTypeName",
        key: "activityFeeTypeName",
        width: 110,
    },
    {
        title: "决裁类型",
        dataIndex: "adjudicationTypeName",
        key: "adjudicationTypeName",
        width: 110,
    },
    {
        title: "标题",
        dataIndex: "activityName",
        width: 100,
        key: "activityName",
    },
    {
        title: "审批状态",
        dataIndex: "state",
        width: 90,
        key: "state",
        render: (text, record, index) => {
            return renderState(text);
        }
    },
    {
        title: "启用状态",
        dataIndex: "isEnable",
        width: 90,
        key: "isEnable",
        render: (text) => {
            return renderEnable(text);
        }
    },
    {
        title: "商品品牌",
        dataIndex: "brandName",
        width: 90,
        key: "brandName",
    },
    {
        title: "商品品类",
        dataIndex: "goodsCategoryName",
        width: 90,
        key: "goodsCategoryName",
    },
    {
        title: "部门片区",
        dataIndex: "reportAreaName",
        width: 100,
        key: "reportAreaName",
    },
    {
        title: "是否失效",
        dataIndex: "ext02",
        key: "ext02",
        width: 150,
        render: (text) => {
            if(text=='0'){
                return '有效';
            }else if (text=='1'){
                return '失效';
            }else {
                return '';
            }
        }
    },
    {
        title: "起案人",
        dataIndex: "reportPersonName",
        width: 100,
        key: "reportPersonName",
    },
    {
        title: "起案日期",
        dataIndex: "reportDate",
        width: 110,
        key: "reportDate",
        render: (text) => {
            return text && ts2Formatter(text)
        }
    },
    {
        title: "创建日期",
        dataIndex: "createDate",
        width: 110,
        key: "createDate",
        render: (text) => {
            return text && ts2Formatter(text)
        }
    },
    // {
    //     title: "计划类型",
    //     dataIndex: "planTypeName",
    //     key: "planTypeName",
    //     width: 100,
    // },
    {
        title: "销量统计依据",
        dataIndex: "saleStatisticBasisName",
        width: 100,
        key: "saleStatisticBasisName",
    },
    {
        title: "客户统计依据",
        dataIndex: "ext07Name",
        width: 100,
        key: "ext07Name",
    },
    // {
    //     title: "费用计算类型",
    //     dataIndex: "costCalculationTypeName",
    //     width: 100,
    //     key: "costCalculationTypeName",
    // },
    {
        title: "紧急程度",
        dataIndex: "urgencyDegreeName",
        width: 100,
        key: "urgencyDegreeName",
    },
    {
        title: "审核日期",
        dataIndex: "approveTime",
        width: 110,
        key: "approveTime",
        render: (text) => {
            return text && ts2Formatter(text)
        }
    },
    {
        title: "计划销售额",
        dataIndex: "planSaleAmount",
        width: 100,
        key: "planSaleAmount",
        sumCol:true
    },
    {
        title: "计划报销额",
        dataIndex: "planCostAmount",
        width: 100,
        key: "planCostAmount",
        sumCol:true
    },
    {
        title: "计划费用额",
        dataIndex: "planCostAmount2",
        width: 100,
        key: "planCostAmount2",
        sumCol:true
    },
    {
        title: "实际销售额",
        dataIndex: "actualSaleAmount",
        width: 100,
        key: "actualSaleAmount",
        sumCol:true
    },
    {
        title: "更新费用额",
        dataIndex: "theoreticalCostAmount",
        width: 100,
        key: "theoreticalCostAmount",
        sumCol:true
    },
    {
        title: "确认金额",
        dataIndex: "confirmationAmount",
        width: 100,
        key: "confirmationAmount",
        sumCol:true
    },
    {
        title: "报销金额",
        dataIndex: "reimbursementAmount",
        width: 100,
        key: "reimbursementAmount",
        sumCol:true
    },
    {
        title: "审批管理",
        dataIndex: "approvalName",
        width: 100,
        key: "approvalName",
    },
    // {
    //     title: "未报金额",
    //     dataIndex: "unreimbursementAmount",
    //     width: 100,
    //     key: "unreimbursementAmount",
    // }
]

export const searchField = [
    {
        enname: "createDate",
        zhname: "订单日期",
        required: false,
        type: "RangePicker",
        rangeField: ["createDate", "createDate"],
        edit: true
    },
    {
        enname: "billCode",
        zhname: "单据号",
        required: false,
        searchType: 'like',
        type: "FormControl",
        edit: true
    },
    {
        enname: "organization",
        zhname: "隶属组织",
        type: "RefComponent",
        param:{
            "AUTH_refdim": "organization", 
            "AUTH_refcod": "ActivityScheme"
        },
        cascadeName: [{
                paramkey: "EQ_organization.id",
                childtype: "DataHeader",
                refKey: "refpk",
                dtoKey: "organization",
                offers: "reportArea",
                resetOffersFlag: true,
            },
            {
                paramkey: "EQ_customerAreas.organization.id",
                childtype: "DataHeader",
                refKey: "refpk",
                dtoKey: "organization",
                offers: "activityDetails&customer",
                resetOffersFlag: true,
            }
        ],
        refname: "organization",
        multiple:true,
        edit: true,
        realRef:true,
    },
    // {
    //     enname: "setlatitude",
    //     zhname: "设置维度",
    //     required: false,
    //     code: "SZWD",
    //     type: "Select",
    //     edit: true,
    // },
    {
        enname: "reportPerson",
        zhname: "起案人",
        type: "RefComponent",
        refname: "personRef",
        multiple:true,
        realRef:true,
        edit: false,
    },
    {
        enname:"ext02",
        zhname:"是否失效",
        required: false,
        type: "Select",
        options: [
            {
                name: '失效', code: "1"
            },
            {
                name: '有效', code: "0"
            },
        ],
        edit: true
    },
    {
        enname:"collect",
        zhname:"是否收藏",
        required: false,
        type: "Select",
        options: [
            {
                name: '已收藏', code: "0"
            },
            {
                name: '未收藏', code: "1"
            },
        ],
        edit: true
    },
    {
        enname: "reportDate",
        zhname: "起案日期段",
        required: false,
        type: "RangePicker",
        rangeField: ["reportDate", "reportDate"],
        edit: true
    },
    {
        enname: "approveTime",
        zhname: "审核日期段",
        required: false,
        type: "RangePicker",
        rangeField: ["approveTime", "approveTime"],
        edit: true
    },
    {
        enname: "activityName",
        zhname: "标题",
        required: false,
        searchType: 'like',
        type: "FormControl",
        edit: true
    },
    {
        enname: "brand",
        zhname: "商品品牌",
        refname: "brandref",
        type: "RefComponent",
        realRef:true,
        multiple:true,
        edit: true,
    },
    {
        enname: "goodsCategory",
        zhname: "商品品类",
        refname: "terminalGoodsCate",
        type: "RefComponent",
        realRef:true,
        multiple:true,
        edit: true,
    },
    {
        enname: "activityDetails&customer",
        zhname: "客户",
        refname: "terminalcustomerRef",
        alias:"organization",
        type: "RefComponent",
        realRef:true,
        multiple:true,
        edit: true,
    },
    {
        enname: "planType",
        zhname: "流程类型",
        required: false,
        code: "PLAN_TYPE",
        type: "Select",
        edit: true,
    },
    {
        enname: "saleStatisticBasis",
        zhname: "销量统计依据",
        required: false,
        code: "SALE_STATISTIC_BASIS",
        type: "Select",
        edit: true,
    },
    {
        enname: "ext07Id",
        zhname: "客户统计依据",
        required: false,
        code: "CUSTOMER_STATISTICS",
        type: "Select",
        edit: true,
    },
    {
        enname: "activityFeeType",
        zhname: "决裁名称",
        refname: "defdoc",
        type: "RefComponent",
        realRef:true,
        multiple:true,
        edit: true,
    },
    {
        enname: "approver",
        zhname: "审批人名称",
        required: false,
        searchType: 'like',
        type: "FormControl",
        edit: true
    },
    {
        enname:"state",
        zhname:"审批状态",
        required: false,
        code:"BILL_STATUS",
        type: "Select",
        edit: true
    },
    {
        enname:"isEnable",
        zhname:"启用状态",
        required: false,
        options: [{
            "key": 1,
            "value": "已启用"
        }, {
            "key": 2,
            "value": "停用"
        }],
        type: "Radio",
        edit: true
    },
    {
        enname: "activityDetails&channelType",
        zhname: "渠道",
        refname: "custchantype",
        type: "RefComponent",
        param:{
            "EQ_enableState": "2"
        },
        realRef:true,
        multiple:true,
        edit: true,
    },
    // {
    //     enname: "customerChannels",
    //     zhname: "渠道类型",
    //     required: false,
    //     refname: "custchantype",
    //     type: "RefComponent",
    //     param:{
    //         "AUTH_refdim": "channelType", 
    //         "AUTH_refcod": "ActivityScheme"
    //     },
    //     realRef: true,
    //     edit: true
    // },
    {
        enname: "reportArea",
        zhname: "部门片区",
        required: false,
        refname: "departmentRef",
        type: "RefComponent",
        alias:"organization",
        param:{
            "AUTH_refdim": "marketarea", 
            "AUTH_refcod": "ActivityScheme"
        },
        realRef: true,
        multiple:true,
        edit: true
    },
    {
        enname:"ext08",
        zhname:"单据来源",
        required: false,
        options: [
            {
                name: '自制新增单据', code: "自制新增单据"
            },
            {
                name: '协同转换单据', code: "协同转换单据"
            },
            {
                name: '失效决裁新增', code: "失效决裁新增"
            },
            {
                name: '导入决裁新增', code: "导入决裁新增"
            },
        ],
        type: "Select",
        edit: true
    },
    {
        enname: "ext04",
        zhname: "来源单据号",
        required: false,
        searchType: 'like',
        type: "FormControl",
        edit: true
    },
    {
        enname:"ext11",
        zhname:"是否负数决裁",
        required: false,
        type: "Select",
        options: [
            {
                name: '正数决裁', code: "正数决裁"
            },
            {
                name: '负数决裁', code: "负数决裁"
            },
        ],
        edit: true
    },
]

export const headerButtonSets = [
    // {
    //     event: "ButtonAdd",
    //     zhname: "新增",
    //     color: 'primary',
    //     authcode: "Schemeadd",
    // },
    {
        event: "ButtonEnable",
        zhname: "启用",
        authcode: "Schemestart",
        method: "post",
        batch: true,
        ContentType: 'application/x-www-form-urlencoded;charset=utf-8',
        url: 'occ-fee/fee/activity-scheme/batch-enable'
    },
    // {
    //     event: "ButtonEnable",
    //     zhname: "停用",
    //     authcode: "Schemestop",
    //     method: "post",
    //     batch: true,
    //     ContentType: 'application/x-www-form-urlencoded;charset=utf-8',
    //     url: 'occ-fee/fee/activity-scheme//batch-disable'
    // }
    {
        event: "ChangeApproveStatus",
        zhname: "审批权限",
        method: "post",
        batch:true,
        ContentType: 'application/x-www-form-urlencoded;charset=utf-8',
        url: 'occ-fee/fee/activity-scheme/change-approve-status'
    }
]

export const columnButtonSets = {
    "delete": {
        event: "ButtonDel",
        zhname: "删除",
        batch: true,
        method: "post",
        ContentType: 'application/x-www-form-urlencoded;charset=utf-8',
        url: 'occ-fee/fee/activity-scheme/deleteByIds'
    },
    "edit": true,
    "detail": true
}

// export default {mainTableColumn,searchField,headerButtonSets,
//     columnButtonSets,childTableColumn,FormTableField,FormField}
export const SelectCode = ["SALE_STATISTIC_BASIS", "SZWD", "ZCLX", "PLAN_TYPE", "CUSTOMER_STATISTICS", "COST_CALCULATION_TYPE", "URGENCY_DEGREE", "BILL_STATUS","QRSP001"]
